<template>
  <h1>Welcome to my app</h1>
  <div v-for="hotel in hotels" :key="hotel.id" style="padding: 10px">
    <el-button type="primary" @click="select(hotel.id)" >{{hotel.name}}</el-button>

  </div>
</template>

<script setup>

import {onMounted, ref} from 'vue'
import axios from "axios";
import router from "@/router/index.js";





const select = (id)=>{
  console.log(id)
  router.push({path: '/login', query: {id: id}})
}





const hotels = ref([])
onMounted(
    ()=>{
      axios.get(`http://localhost:8000/app/hotel/`)
          .then(res=>{
            console.log(res.data)
            hotels.value = res.data
          })
    }
)

</script>